package cn.tedu._03vehicle_test.controller;

import cn.tedu._03vehicle_test.base.response.JsonResult;
import cn.tedu._03vehicle_test.base.response.StatusCode;
import cn.tedu._03vehicle_test.mapper.NoticeMapper;
import cn.tedu._03vehicle_test.pojo.vo.NoticeVO;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@Api(tags = "公告管理模块")
@Slf4j
@RestController
@RequestMapping("/v1/notice/")
public class NoticeController {
    @Autowired
    private NoticeMapper noticeMapper;

    @GetMapping("list")
    @ApiOperation("公告展示")
    @ApiOperationSupport(order = 10)
    public JsonResult noticeselect(){
        log.debug("开始展示前十条数据：");
        List<NoticeVO> noticeVO = noticeMapper.selectNotice();
        if(noticeVO == null){
            return new JsonResult(StatusCode.OPERATION_FAILED);

        }
        return JsonResult.ok(noticeVO);
    }
}
